//
//  CartoonDetailsUpdateTableViewCell.m
//  Cartoon
//
//  Created by dllo on 15/10/31.
//  Copyright © 2015年 YSZ. All rights reserved.
//

#import "CartoonDetailsUpdateTableViewCell.h"

@implementation CartoonDetailsUpdateTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.myAuthorLabel = [UILabel new];
        self.myAuthorNameLabel = [UILabel new];
        self.myClassifyLabel1 = [UILabel new];
        self.myClassifyLabel2 = [UILabel new];
        self.myClassifyLabel3 = [UILabel new];
        self.myContentLabel = [UILabel new];
        self.myImageView = [UIImageView new];
        self.myTitleLabel = [UILabel new];
        self.myUpdateTimeLabel = [UILabel new];
        self.myAuthorLabel.hidden = YES;
        self.myAuthorNameLabel.hidden = YES;
        self.myClassifyLabel1.hidden = YES;
        self.myClassifyLabel2.hidden = YES;
        self.myClassifyLabel3.hidden = YES;
        self.myContentLabel.hidden = YES;
        self.myImageView.hidden = YES;
        self.myTitleLabel.hidden = YES;
        self.myUpdateTimeLabel.hidden = YES;
        [self.contentView addSubview:_myAuthorLabel];
        [self.contentView addSubview:_myAuthorNameLabel];
        [self.contentView addSubview:_myClassifyLabel1];
        [self.contentView addSubview:_myClassifyLabel2];
        [self.contentView addSubview:_myClassifyLabel3];
        [self.contentView addSubview:_myContentLabel];
        [self.contentView addSubview:_myImageView];
        [self.contentView addSubview:_myTitleLabel];
        [self.contentView addSubview:_myUpdateTimeLabel];
        
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];

    CGFloat height = self.bounds.size.height;
    CGFloat width = self.bounds.size.width;
    _myImageView.frame = CGRectMake(20, 10, height - 20, height - 20);
    _myImageView.layer.cornerRadius = _myImageView.frame.size.width / 2;
    _myImageView.clipsToBounds = YES;
    _myAuthorLabel.frame = CGRectMake(_myImageView.frame.origin.x + _myImageView.frame.size.width + 20, 10, width, height / 3);
    _myAuthorNameLabel.frame = CGRectMake(_myImageView.frame.origin.x + _myImageView.frame.size.width + 20,_myAuthorLabel.frame.origin.y + height / 3, width, height / 3 * 2);
    
    
    _myTitleLabel.frame = CGRectMake(20, 10, width, height / 5);
    _myContentLabel.frame = CGRectMake(20, _myTitleLabel.frame.origin.y + _myTitleLabel.frame.size.height + 10, width - 20 - 20, height);
    _myContentLabel.numberOfLines = 0;
    [_myContentLabel sizeToFit];
    
    
    _myClassifyLabel1.frame = CGRectMake(20, _myTitleLabel.frame.origin.y + _myTitleLabel.frame.size.height + 10, 40, 20);
    _myClassifyLabel1.layer.cornerRadius = 5;
    _myClassifyLabel1.clipsToBounds = YES;
    _myClassifyLabel1.textAlignment = NSTextAlignmentCenter;
    _myClassifyLabel1.backgroundColor = [UIColor redColor];
    
    _myClassifyLabel2.frame = CGRectMake(20 + _myClassifyLabel1.frame.size.width + 10, _myTitleLabel.frame.origin.y + _myTitleLabel.frame.size.height + 10, 40, 20);
    _myClassifyLabel2.layer.cornerRadius = 5;
    _myClassifyLabel2.clipsToBounds = YES;
    _myClassifyLabel1.textAlignment = NSTextAlignmentCenter;
    _myClassifyLabel2.backgroundColor = [UIColor orangeColor];
    
    _myClassifyLabel3.frame = CGRectMake(_myClassifyLabel2.frame.origin.x + _myClassifyLabel2.frame.size.width + 10, _myTitleLabel.frame.origin.y + _myTitleLabel.frame.size.height + 10, 40, 20);
    _myClassifyLabel3.layer.cornerRadius = 5;
    _myClassifyLabel3.clipsToBounds = YES;
    _myClassifyLabel1.textAlignment = NSTextAlignmentCenter;
    _myClassifyLabel3.backgroundColor = [UIColor greenColor];
    
    _myUpdateTimeLabel.frame = CGRectMake(20, _myTitleLabel.frame.origin.y + _myTitleLabel.frame.size.height + 10, width, 20);
    
    
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
